package com.hs.android.fortress.model;

import java.util.ArrayList;

public class Room{
    
    private final int MAX_PLAYER = 3;
    
    private ArrayList<Player> playerList;
    private RoomInformation roomInfo;
    
    public Room(){}
    
    public Room(int id, String name){
        roomInfo = new RoomInformation(id, name);
        
        playerList = new ArrayList<Player>();
    }
    
    public int getRoomId(){
        return roomInfo.getRoomId();
    }
    
    public int getRoomState(){
        return roomInfo.getState();
    }
    
    public String getRoomName(){
        return roomInfo.getRoomName();
    }
    
    private boolean isFull(){
        return playerList.size()<MAX_PLAYER?false:true;
    }

    public ArrayList<Player> getPlayerList() {
        return playerList;
    }

    public void setPlayerList(ArrayList<Player> playerList) {
        this.playerList = playerList;
    }
    
    public RoomInformation getRoomInfo() {
        return roomInfo;
    }

    public void setRoomInfo(RoomInformation roomInfo) {
        this.roomInfo = roomInfo;
    }
    
    public int getPlayerNumber(){
        return roomInfo.getPlayerNumber();
    }
    
    public double getWindDeg(){
    	return roomInfo.getWindDeg();
    }
    
    public float getWindSpeed(){
    	return roomInfo.getWindSpeed();
    }
    
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Room)) {
            return false;
        }
        Room other = (Room) object;
        if ((this.getRoomId() == 0 && other.getRoomId() != 0) || (this.getRoomId() != 0 && !(this.getRoomId()==other.getRoomId()))) {
            return false;
        }
        return true;
    }
}
